package st.business.tepth.business.user.busnumber.finishholder.repair;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.EditText;
import android.widget.TextView;

import java.util.Date;

import st.business.tepth.R;
import st.business.tepth.base.OnItemChooseListener;
import st.business.tepth.manager.UserManager;
import st.shadow.library.core.util.utilcode.util.TimeUtils;

/**
 * @author zhangyu
 * @date 2019/7/31
 */
public class DialogRework extends Dialog {
    public DialogRework(@NonNull Context context, final OnItemChooseListener<String> listener) {
        super(context);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        View view = LayoutInflater.from(context).
                inflate(R.layout.dialog_finish_rework, null);
        TextView tvCheckTime = view.findViewById(R.id.tv_check_time);
        tvCheckTime.setText(TimeUtils.date2String(new Date(System.currentTimeMillis())));
        TextView tvPerson = view.findViewById(R.id.tv_check_person);
        tvPerson.setText(UserManager.getInstance().getCurrentUserName());
        final EditText etRemark = view.findViewById(R.id.et_check_remark);
        view.findViewById(R.id.tv_confirm).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener != null) {
                    listener.onChoose(etRemark.getText().toString());
                }
                dismiss();
            }
        });
        setContentView(view);
    }
}
